fix(web): retain terminal PR badges after checkout switch - #4755
fix(web): retain terminal PR badges after checkout switch#4755sebbonit wants to merge 5 commits into
Conversation
Keep merged/closed local-checkout PR metadata in Sidebar V2 when the shared checkout moves to another branch, so settled rows stay settled with their original badge.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved This is a self-contained UI bug fix that caches terminal PR badge states (merged/closed) so they persist when users switch branches. The majority of the additions are comprehensive unit tests. No security, auth, or billing implications. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 87e936b. Configure here.

What Changed
Fixes #4752.
Sidebar V2 now keeps a parent-level PR snapshot (branch, full PR object, provider) instead of only
"open" | "merged" | "closed".Why
After a local-checkout thread’s PR was observed as merged/closed, switching the shared checkout to
mainmaderesolveThreadPrreturnnull(branch mismatch). That cleared the parent map, unssettled the thread, and dropped the PR badge. Retaining the previously verified terminal PR at the Sidebar V2 parent is enough; no contracts/server changes.UI Changes
Settled local-checkout rows keep their PR number, link, title, provider terminology, and terminal color after switching away from the thread branch. No layout changes.
Checklist
Note
Retain terminal PR badges in sidebar and chat view after checkout switch
threadChangeRequestSnapshotsAtomto persist per-thread PR snapshots (branch, PR state, provider) in memory across component unmounts.resolveDisplayedThreadPrandresolveDisplayedThreadPrProviderto fall back to a cached merged/closed PR snapshot when the active checkout branch no longer matches the thread branch, but only for local (non-worktree) checkouts.SidebarV2RowandChatViewContentto use the new resolver and snapshot atom, so thread settlement classification (settled vs inbox) correctly accounts for retained terminal PRs.Macroscope summarized 703413f.
Note
Medium Risk
Touches sidebar partitioning, chat settlement UI, and shared atom state; behavior is well-covered by tests but incorrect retention could mis-label PR status or settled rows.
Overview
Fixes sidebar and chat losing merged/closed PR badges and auto-settlement when a local-checkout thread’s shared git checkout moves off the thread branch (e.g. to
main).Sidebar V2 and ChatView now share a parent-level
threadChangeRequestSnapshotsAtom(branch, full PR, provider) instead of bubbling only PR state. Rows update snapshots vianextThreadChangeRequestSnapshotonly on authoritative VCS when the live ref matches the thread branch; branch mismatch or missing VCS no longer clears a verified terminal snapshot for local threads (worktreePath === null).resolveDisplayedThreadPr/resolveDisplayedThreadPrProviderdrive badges andeffectiveSettledthe same way in the sidebar partition and chat banner. Open PRs are never shown or retained across mismatch; worktree threads clear snapshots on branch mismatch.Reviewed by Cursor Bugbot for commit 703413f. Bugbot is set up for automated code reviews on this repo. Configure here.